//
//  UIView+Extension.swift
//  sinaweibo
//
//  Created by mac on 15/11/16.
//  Copyright © 2015年 mac. All rights reserved.
//

import UIKit

extension UIView{

    //通过响应者链条找到导航控制器
    func NavController () -> UINavigationController? {
    
        //遍历响应者链条
        var next = self.nextResponder()
        
        repeat{
            if next is UINavigationController{
                return next as? UINavigationController
            }
            next = next?.nextResponder()
        
        }while(next != nil)
        
        return nil
    }
}
